<?php
/**
 * ProjektMan
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   ProjektMan
 * @name       Project.php
 * @license    LICENSE.txt     New BSD License
 */

/**
 * Table model for project
 *
 * @category   ProjektMan
 * @name       Project
 * @license    LICENSE.txt     New BSD License
 */
class Project extends Projekt_Model
{
    /**
     * Get the project status
     *
     * @return Status
     */
    public function getStatus()
    {
        $status = new StatusList();
        $row = $status->find($this->status_id);

        return $row[0];
    }

    /**
     * Get the project owner
     *
     * @return User
     */
    public function getOwner()
    {
        $user = new UserList();
        $row = $user->find($this->owner_id);

        return $row[0];
    }


    /**
     * Get the project history
     *
     * @return Zend_Db_Table_Rowset
     */
    public function getHistory()
    {
    	$history = new ProjectHistoryList();
    	$rows = $history->fetchAll($history->select()->where('project_id=?', $this->project_id));

    	return $rows;
    }

    /**
     * Get the tasks for this project
     *
     * @return Zend_Db_Table_Rowset
     */
    public function getTasks()
    {
    	$task = new TaskList();
    	$rows = $task->fetchAll($task->select()->where('project_id=?', $this->project_id));

    	return $rows;
    }
}
